"use strict";

/*
 * MikoPBX - free phone system for small business
 * Copyright © 2017-2023 Alexey Portnov and Nikolay Beketov
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License along with this program.
 * If not, see <https://www.gnu.org/licenses/>.
 */

/* global globalRootUrl, PbxApi, globalTranslate, UserMessage */

/**
 * Class for module uninstallation.
 *
 * @class deleteModule
 * @memberof module:PbxExtensionModules
 */
var _deleteModule = {
  /**
   * jQuery object for the delete module modal form.
   * @type {jQuery}
   */
  $deleteModalForm: $('#delete-modal-form'),

  /**
   * jQuery object for checkbox which flags store module settings for future installations or not.
   * @type {jQuery}
   */
  $keepSettingsCheckbox: $('#keepModuleSettings'),

  /**
   * Initialize extensionModules list
   */
  initialize: function initialize() {
    _deleteModule.$deleteModalForm.modal();
    /**
     * Event handler for the delete link click event.
     * @param {Event} e - The click event object.
     */


    $('a.delete').on('click', function (e) {
      e.preventDefault();
      $('a.button').addClass('disabled');
      $(e.target).closest('a').removeClass('disabled');
      var params = {};
      params.uniqid = $(e.target).closest('tr').data('id');

      _deleteModule.deleteModule(params);
    });
  },

  /**
   * Delete a module.
   * @param {Object} params - The request parameters.
   */
  deleteModule: function deleteModule(params) {
    // Ask the user if they want to keep the settings
    _deleteModule.$deleteModalForm.modal({
      closable: false,
      onDeny: function onDeny() {
        $('a.button').removeClass('disabled');
        return true;
      },
      onApprove: function onApprove() {
        // Check if the module is enabled, if enabled, disable it
        var status = $("#".concat(params.uniqid)).find('.checkbox').checkbox('is checked');

        var keepSettings = _deleteModule.$keepSettingsCheckbox.checkbox('is checked');

        if (status === true) {
          PbxApi.ModulesDisableModule(params.uniqid, function () {
            PbxApi.ModulesUnInstallModule(params.uniqid, keepSettings, extensionModules.cbAfterDelete);
          });
        } else {
          PbxApi.ModulesUnInstallModule(params.uniqid, keepSettings, _deleteModule.cbAfterDelete);
        }

        return true;
      }
    }).modal('show');
  },

  /**
   * Callback function after deleting a module.
   * If successful, reload the page; if not, display an error message.
   * @param {boolean} result - The result of the module deletion.
   */
  cbAfterDelete: function cbAfterDelete(result) {
    $('a.button').removeClass('disabled');

    if (result === true) {
      window.location = "".concat(globalRootUrl, "pbx-extension-modules/index/");
    } else {
      $('.ui.message.ajax').remove();
      var errorMessage = result.data !== undefined ? result.data : '';
      errorMessage = errorMessage.replace(/\n/g, '<br>');
      UserMessage.showMultiString(errorMessage, globalTranslate.ext_DeleteModuleError);
    }
  }
}; // When the document is ready, initialize the delete module class

$(document).ready(function () {
  _deleteModule.initialize();
});
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9QYnhFeHRlbnNpb25Nb2R1bGVzL3BieC1leHRlbnNpb24tbW9kdWxlLWRlbGV0ZS5qcyJdLCJuYW1lcyI6WyJkZWxldGVNb2R1bGUiLCIkZGVsZXRlTW9kYWxGb3JtIiwiJCIsIiRrZWVwU2V0dGluZ3NDaGVja2JveCIsImluaXRpYWxpemUiLCJtb2RhbCIsIm9uIiwiZSIsInByZXZlbnREZWZhdWx0IiwiYWRkQ2xhc3MiLCJ0YXJnZXQiLCJjbG9zZXN0IiwicmVtb3ZlQ2xhc3MiLCJwYXJhbXMiLCJ1bmlxaWQiLCJkYXRhIiwiY2xvc2FibGUiLCJvbkRlbnkiLCJvbkFwcHJvdmUiLCJzdGF0dXMiLCJmaW5kIiwiY2hlY2tib3giLCJrZWVwU2V0dGluZ3MiLCJQYnhBcGkiLCJNb2R1bGVzRGlzYWJsZU1vZHVsZSIsIk1vZHVsZXNVbkluc3RhbGxNb2R1bGUiLCJleHRlbnNpb25Nb2R1bGVzIiwiY2JBZnRlckRl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b2R1bGVzIGxpc3RcbiAgICAgKi9cbiAgICBpbml0aWFsaXplKCkge1xuXG4gICAgICAgIGRlbGV0ZU1vZHVsZS4kZGVsZXRlTW9kYWxGb3JtLm1vZGFsKCk7XG5cbiAgICAgICAgLyoqXG4gICAgICAgICAqIEV2ZW50IGhhbmRsZXIgZm9yIHRoZSBkZWxldGUgbGluayBjbGljayBldmVudC5cbiAgICAgICAgICogQHBhcmFtIHtFdmVudH0gZSAtIFRoZSBjbGljayBldmVudCBvYmplY3QuXG4gICAgICAgICAqL1xuICAgICAgICAkKCdhLmRlbGV0ZScpLm9uKCdjbGljaycsIChlKSA9PiB7XG4gICAgICAgICAgICBlLnByZXZlbnREZWZhdWx0KCk7XG4gICAgICAgICAgICAkKCdhLmJ1dHRvbicpLmFkZENsYXNzKCdkaXNhYmxlZCcpO1xuICAgICAgICAgICAgJChlLnRhcmdldCkuY2xvc2VzdCgnYScpLnJlbW92ZUNsYXNzKCdkaXNhYmxlZCcpO1xuICAgICAgICAgICAgY29uc3QgcGFyYW1zID0ge307XG4gICAgICAgICAgICBwYXJhbXMudW5pcWlkID0gJChlLnRhcmdldCkuY2xvc2VzdCgndHInKS5kYXRhKCdpZCcpO1xuICAgICAgICAgICAgZGVsZXRlTW9kdWxlLmRlbGV0ZU1vZHVsZShwYXJhbXMpO1xuICAgICAgICB9KTtcbiAgICB9LFxuXG5cbiAgICAvKipcbiAgICAgKiBEZWxldGUgYSBtb2R1bGUuXG4gICAgICogQHBhcmFtIHtPYmplY3R9IHBhcmFtcyAtIFRoZSByZXF1ZXN0IHBhcmFtZXRlcnMuXG4gICAgICovXG4gICAgZGVsZXRlTW9kdWxlKHBhcmFtcykge1xuICAgICAgICAvLyBBc2sgdGhlIHVzZXIgaWYgdGhleSB3YW50IHRvIGtlZXAgdGhlIHNldHRpbmdzXG4gICAgICAgIGRlbGV0ZU1vZHVsZS4kZGVsZXRlTW9kYWxGb3JtXG4gICAgICAgICAgICAubW9kYWwoe1xuICAgICAgICAgICAgICAgIGNsb3NhYmxlOiBmYWxzZSxcbiAgICAgICAgICAgICAgICBvbkRlbnk6ICgpID0+IHtcbiAgICAgICAgICAgICAgICAgICAgJCgnYS5idXR0b24nKS5yZW1vdmVDbGFzcygnZGlzYWJsZWQnKTtcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRydWU7XG4gICAgICAgICAgICAgICAgfSxcbiAgICAgICAgICAgICAgICBvbkFwcHJvdmU6ICgpID0+IHtcbiAgICAgICAgICAgICAgICAgICAgLy8gQ2hlY2sgaWYgdGhlIG1vZHVsZSBpcyBlbmFibGVkLCBpZiBlbmFibGVkLCBkaXNhYmxlIGl0XG4gICAgICAgICAgICAgICAgICAgIGNvbnN0IHN0YXR1cyA9ICQoYCMke3BhcmFtcy51bmlxaWR9YCkuZmluZCgnLmNoZWNrYm94JykuY2hlY2tib3goJ2lzIGNoZWNrZWQnKTtcbiAgICAgICAgICAgICAgICAgICAgY29uc3Qga2VlcFNldHRpbmdzID0gZGVsZXRlTW9kdWxlLiRrZWVwU2V0dGluZ3NDaGVja2JveC5jaGVja2JveCgnaXMgY2hlY2tlZCcpO1xuICAgICAgICAgICAgICAgICAgICBpZiAoc3RhdHVzID09PSB0cnVlKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBQYnhBcGkuTW9kdWxlc0Rpc2FibGVNb2R1bGUocGFyYW1zLnVuaXFpZCwgKCkgPT4ge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIFBieEFwaS5Nb2R1bGVzVW5JbnN0YWxsTW9kdWxlKFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwYXJhbXMudW5pcWlkLFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBrZWVwU2V0dGluZ3MsXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGV4dGVuc2lvbk1vZHVsZXMuY2JBZnRlckRlbGV0ZSxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICApO1xuICAgICAgICAgICA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